import request from "@/utils/request";

/**
* ${table.comment}数据
*
* @param queryParams
*/
export function get${entity}Page(queryParams) {
    return request({
        url: '/api/v1/${table.entityPath?replace("sys","")?uncap_first}/page',
        method: 'get',
        params: queryParams
    });
}


/**
* 获取${table.comment}表单数据
*
* @param queryParams
*/
export function get${entity}Form(id) {
    return request({
        url: '/api/v1/${table.entityPath?replace("sys","")?uncap_first}/' + id + '/form',
        method: 'get'
    });
}

/**
* 保存${table.comment}
*
* @param data
*/
export function save${entity}(data) {
    return request({
        url: "/api/v1/${table.entityPath?replace("sys","")?uncap_first}",
        method: "post",
        data: data,
    });
}

/**
* 删除${table.comment}
*
* @param ids
*/
export function delete${entity}(ids) {
    return request({
        url: '/api/v1/${table.entityPath?replace("sys","")?uncap_first}/' + ids,
        method: 'delete'
    });
}

/**
* 导入${table.comment!}
*
* @param file
*/
export function import${entity}(file: any) {
    const formData = new FormData();
    formData.append('file', file);
    return request({
        url: '/api/v1/${table.entityPath?replace("sys","")?uncap_first}/${entity?uncap_first}Import',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    });
}

/**
* 导出${table.comment!}
*
* @param ids
* @returns
*/
export function export${entity}(ids: any) {
    return request({
        url: '/api/v1/${table.entityPath?replace("sys","")?uncap_first}/_export?ids='+ids,
        method: 'get',
        responseType: 'arraybuffer'
    });
}